package com.coder4j.starter.web;

/**
 * 自定义异常
 * @author Keller
 * @date 2019-07-18 09:49:17
 */
public class BaseException extends RuntimeException{

    private String code;

    private String message;

    public BaseException(String message){
        super(message);
    }

    public static BaseException error(String message){
        return new BaseException(message);
    }

    public BaseException(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static BaseException noData(){
        return new BaseException("无数据");
    }

    public static BaseException inconsistentData(){
        return new BaseException("数据不一致");
    }

    public static BaseException errorData() {
        return new BaseException("数据错误");
    }

    public static BaseException noAuth() {
        return new BaseException("无权限");
    }
}
